<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

  <title>Class: SQLConstructor</title>

  <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

  <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="./lib/sqlconstructor_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="lib/sqlconstructor.rb">lib/sqlconstructor.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link"><a href="SQLObject.html">SQLObject</a></p>
        
      </div>
      

      

      
      <!-- Namespace Contents -->
      <div id="namespace-list-section" class="section">
        <h3 class="section-header">Namespace</h3>
        <ul class="link-list">
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
          
          <li><span class="type">CLASS</span> <a href="SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
          
        </ul>
      </div>
      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-c-new">::new</a></li>
          
          <li><a href="#method-i-_getGenericQuery">#_getGenericQuery</a></li>
          
          <li><a href="#method-i-delete">#delete</a></li>
          
          <li><a href="#method-i-insert">#insert</a></li>
          
          <li><a href="#method-i-method_missing">#method_missing</a></li>
          
          <li><a href="#method-i-select">#select</a></li>
          
          <li><a href="#method-i-to_s">#to_s</a></li>
          
          <li><a href="#method-i-to_str">#to_str</a></li>
          
          <li><a href="#method-i-update">#update</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      
      <div id="fileindex-section" class="section project-section">
        <h3 class="section-header">Files</h3>
        <ul>
        
          <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
        
        </ul>
      </div>
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="./images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="./SQLConstructor.html">SQLConstructor</a></li>
        
          <li><a href="./SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
        
          <li><a href="./SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
        
          <li><a href="./SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
        
          <li><a href="./SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
        
          <li><a href="./SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
        
          <li><a href="./SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
        
          <li><a href="./SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
        
          <li><a href="./SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
        
          <li><a href="./SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
        
          <li><a href="./SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
        
          <li><a href="./SQLExporter.html">SQLExporter</a></li>
        
          <li><a href="./SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
        
          <li><a href="./SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
        
          <li><a href="./SQLConditional.html">SQLConditional</a></li>
        
          <li><a href="./SQLConditional/BasicCond.html">SQLConditional::BasicCond</a></li>
        
          <li><a href="./Object.html">Object</a></li>
        
          <li><a href="./SQLAliasedList.html">SQLAliasedList</a></li>
        
          <li><a href="./SQLColumn.html">SQLColumn</a></li>
        
          <li><a href="./SQLCondList.html">SQLCondList</a></li>
        
          <li><a href="./SQLConstructorTest.html">SQLConstructorTest</a></li>
        
          <li><a href="./SQLObject.html">SQLObject</a></li>
        
          <li><a href="./SQLValList.html">SQLValList</a></li>
        
          <li><a href="./SQLValue.html">SQLValue</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">SQLConstructor</h1>

    <div id="description" class="description">
      <table class="rdoc-list"><tr><td class="rdoc-term"><p>Author</p></td>
<td>
<p>Vasiliy Korol  (<a href="mailto:vakorol@mail.ru">vakorol@mail.ru</a>)</p>
</td></tr><tr><td class="rdoc-term"><p>Copyright</p></td>
<td>
<p>Vasiliy Korol © 2014</p>
</td></tr><tr><td class="rdoc-term"><p>License</p></td>
<td>
<p>Distributes under terms of GPLv2</p>
</td></tr></table>

<p>This class implements methods to construct a valid SQL query. SQL SELECT,
DELETE, UPDATE and INSERT clauses are supported.</p>

<p>There’s also an experimental implementation of MySQL index hints.</p>

<p>Column values and other data that should be escaped is passed to the
methods as strings.  Column and table names, aliases and everything that
goes unescaped is passed as symbols.</p>

<h3>Typical usage:</h3>

<pre>sql = SQLConstructor.new
sql.select( :col1, :col2 ).from( :table ).where.eq( :col3, 16 ).and.lt( :col4, 5 )
p sql</pre>

<p>will result in:</p>

<pre>SELECT  col1,col2 FROM table WHERE  (col3 = 16  AND col4 &lt; 5)</pre>

<p>One can also construct complex queries like:</p>

<pre>sql = SQLConstructor.new( :tidy =&gt; true, :dialect =&gt; 'mysql' )
inner_select1 = SQLConstructor.new( :tidy =&gt; true )
inner_select1.select( :&quot;MAX(h.item_id)&quot; ).from( :item_data =&gt; :d ).
  inner_join( :call_data =&gt; :h ).on.eq( :&quot;d.item_nm&quot;, :call_ref ).where.
      eq( :&quot;d.item_num&quot;, :&quot;g.item_num&quot; ).group_by( :&quot;h.venue_nm&quot; ).having.eq( :&quot;COUNT(*)&quot;, 1 )
inner_select2 = SQLConstructor.new( :dialect =&gt; 'mysql', :tidy =&gt; true )
inner_select2.select( :&quot;d.item_num&quot; ).from( :item_data =&gt; :d ).
      inner_join( :call_data =&gt; :h ).on.eq( :&quot;d.item_nm&quot;, :call_ref ).
      group_by( :&quot;h.venue_nm&quot; ).having.eq( :&quot;COUNT(*)&quot;, 1 )
sql.update( :guest =&gt; :g ).set( :link_id =&gt; inner_select1).
    where.in( :&quot;g.item_num&quot;, inner_select2 )
p sql</pre>

<p>It will produce:</p>

<pre>UPDATE
 guest g
SET link_id=
(SELECT
 MAX(h.item_id)
FROM item_data d
INNER JOIN call_data h
ON 
(d.item_nm = call_ref)
WHERE 
(d.item_num = g.item_num)
GROUP BY h.venue_nm
HAVING 
(COUNT(*) = 1)
)
WHERE 
(g.item_num IN 
(SELECT
 d.item_num
FROM item_data d
INNER JOIN call_data h
ON 
(d.item_nm = call_ref)
GROUP BY h.venue_nm
HAVING 
(COUNT(*) = 1)
))</pre>

<p>Queries can be modified “on the fly”, which can be useful for dynamic
construction:</p>

<pre>sql.delete.from( :datas ).where.ne( :x, &quot;SOME TEXT&quot; ).order_by( :y )
p sql

DELETE
FROM datas
WHERE 
(x != 'SOME TEXT')
ORDER BY y

sql._remove( :order_by )
sql._get( :from ).push( :dataf )
p sql

DELETE
FROM datas,dataf
WHERE 
(x != 'SOME TEXT')</pre>

    </div><!-- description -->

    
    
    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      
      <!-- Attributes -->
      <div id="attribute-method-details" class="method-section section">
        <h3 class="section-header">Attributes</h3>

        
        <div id="dialect-attribute-method" class="method-detail">
          <a name="dialect"></a>
          
          <div class="method-heading attribute-method-heading">
            <span class="method-name">dialect</span><span
              class="attribute-access-type">[R]</span>
          </div>

          <div class="method-description">
          
          
          
          </div>
        </div>
        
        <div id="exporter-attribute-method" class="method-detail">
          <a name="exporter"></a>
          
          <a name="exporter="></a>
          
          <div class="method-heading attribute-method-heading">
            <span class="method-name">exporter</span><span
              class="attribute-access-type">[RW]</span>
          </div>

          <div class="method-description">
          
          
          
          </div>
        </div>
        
        <div id="obj-attribute-method" class="method-detail">
          <a name="obj"></a>
          
          <div class="method-heading attribute-method-heading">
            <span class="method-name">obj</span><span
              class="attribute-access-type">[R]</span>
          </div>

          <div class="method-description">
          
          
          
          </div>
        </div>
        
        <div id="tidy-attribute-method" class="method-detail">
          <a name="tidy"></a>
          
          <a name="tidy="></a>
          
          <div class="method-heading attribute-method-heading">
            <span class="method-name">tidy</span><span
              class="attribute-access-type">[RW]</span>
          </div>

          <div class="method-description">
          
          
          
          </div>
        </div>
        
      </div><!-- attribute-method-details -->
      

      <!-- Methods -->
      
      <div id="public-class-method-details" class="method-section section">
        <h3 class="section-header">Public Class Methods</h3>

      
        <div id="new-method" class="method-detail ">
          <a name="method-c-new"></a>

          
          <div class="method-heading">
            <span class="method-name">new</span><span
              class="method-args">( params = nil )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Class constructor. Accepts an optional argument with a hash of parameters
:dialect and :tidy to set the <a href="SQLExporter.html">SQLExporter</a>
object in @exporter, or :exporter to receive a predefined <a
href="SQLExporter.html">SQLExporter</a> object.</p>
            

            
            <div class="method-source-code" id="new-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 108</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> ( <span class="ruby-identifier">params</span> = <span class="ruby-keyword">nil</span> )
    <span class="ruby-ivar">@dialect</span>, <span class="ruby-ivar">@string</span>, <span class="ruby-ivar">@obj</span>, <span class="ruby-ivar">@tidy</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
        <span class="ruby-ivar">@dialect</span>  = <span class="ruby-identifier">params</span>[ <span class="ruby-value">:dialect</span>  ]
        <span class="ruby-ivar">@tidy</span>     = <span class="ruby-identifier">params</span>[ <span class="ruby-value">:tidy</span>     ]
        <span class="ruby-ivar">@exporter</span> = <span class="ruby-identifier">params</span>[ <span class="ruby-value">:exporter</span> ]
    <span class="ruby-keyword">end</span>
    <span class="ruby-ivar">@exporter</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">SQLExporter</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@dialect</span>, <span class="ruby-ivar">@tidy</span>
    <span class="ruby-ivar">@dialect</span> = <span class="ruby-ivar">@exporter</span>.<span class="ruby-identifier">dialect</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- new-source -->
            
          </div>

          

          
        </div><!-- new-method -->

      
      </div><!-- public-class-method-details -->
    
      <div id="public-instance-method-details" class="method-section section">
        <h3 class="section-header">Public Instance Methods</h3>

      
        <div id="delete-method" class="method-detail ">
          <a name="method-i-delete"></a>

          
          <div class="method-heading">
            <span class="method-name">delete</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Add a DELETE statement. Returns an instance of <a
href="http://%dialect%">BasicDelete_</a> class.</p>
            

            
            <div class="method-source-code" id="delete-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 131</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete</span>
    <span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'delete'</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- delete-source -->
            
          </div>

          

          
        </div><!-- delete-method -->

      
        <div id="insert-method" class="method-detail ">
          <a name="method-i-insert"></a>

          
          <div class="method-heading">
            <span class="method-name">insert</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Add a INSERT statement Returns an instance of <a
href="http://%dialect%">BasicInsert_</a> class.</p>
            

            
            <div class="method-source-code" id="insert-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 139</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">insert</span>
    <span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'insert'</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- insert-source -->
            
          </div>

          

          
        </div><!-- insert-method -->

      
        <div id="method_missing-method" class="method-detail ">
          <a name="method-i-method_missing"></a>

          
          <div class="method-heading">
            <span class="method-name">method_missing</span><span
              class="method-args">( method, *args )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Pass all unknown methods to @obj or throw an exception if the call already
originated from @obj.</p>
            

            
            <div class="method-source-code" id="method_missing-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 165</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span> ( <span class="ruby-identifier">method</span>, *<span class="ruby-identifier">args</span> )
    <span class="ruby-keyword">return</span> <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">send</span>( <span class="ruby-identifier">method</span>, *<span class="ruby-identifier">args</span> )  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@obj</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">child_caller</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@obj</span>  
     <span class="ruby-comment"># raise an exception if the call is &quot;bouncing&quot; between self and @obj</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>, <span class="ruby-constant">ERR_UNKNOWN_METHOD</span> <span class="ruby-operator">+</span> 
        <span class="ruby-node">&quot;: '#{method.to_s}' from #{@obj.class.name}&quot;</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- method_missing-source -->
            
          </div>

          

          
        </div><!-- method_missing-method -->

      
        <div id="select-method" class="method-detail ">
          <a name="method-i-select"></a>

          
          <div class="method-heading">
            <span class="method-name">select</span><span
              class="method-args">( *cols )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Add a SELECT statement with columns specified by *cols. Returns an instance
of <a href="http://%dialect%">BasicSelect_</a> class.</p>
            

            
            <div class="method-source-code" id="select-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 123</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">select</span> ( *<span class="ruby-identifier">cols</span> )
    <span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'select'</span>, *<span class="ruby-identifier">cols</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- select-source -->
            
          </div>

          

          
        </div><!-- select-method -->

      
        <div id="to_s-method" class="method-detail ">
          <a name="method-i-to_s"></a>

          
          <div class="method-heading">
            <span class="method-name">to_s</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Convert object to string by calling the .export() method of the @exporter
object.</p>
            

            
            <div class="method-source-code" id="to_s-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 155</span>
    <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
<span class="ruby-comment">#        return @string  if @string</span>
        <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">inline</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inline</span>
        <span class="ruby-ivar">@string</span> = <span class="ruby-ivar">@exporter</span>.<span class="ruby-identifier">export</span> <span class="ruby-ivar">@obj</span>
    <span class="ruby-keyword">end</span></pre>
            </div><!-- to_s-source -->
            
          </div>

          
          <div class="aliases">
            Also aliased as: <a href="SQLConstructor.html#method-i-to_str">to_str</a>
          </div>
          

          
        </div><!-- to_s-method -->

      
        <div id="to_str-method" class="method-detail method-alias">
          <a name="method-i-to_str"></a>

          
          <div class="method-heading">
            <span class="method-name">to_str</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Dirty hack to make .join work on an array of SQLConstructors</p>
            

            
          </div>

          

          
          <div class="aliases">
            Alias for: <a href="SQLConstructor.html#method-i-to_s">to_s</a>
          </div>
          
        </div><!-- to_str-method -->

      
        <div id="update-method" class="method-detail ">
          <a name="method-i-update"></a>

          
          <div class="method-heading">
            <span class="method-name">update</span><span
              class="method-args">( *tabs )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Add a UPDATE statement Returns an instance of <a
href="http://%dialect%">BasicUpdate_</a> class.</p>
            

            
            <div class="method-source-code" id="update-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 147</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update</span> ( *<span class="ruby-identifier">tabs</span> )
    <span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'update'</span>, *<span class="ruby-identifier">tabs</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- update-source -->
            
          </div>

          

          
        </div><!-- update-method -->

      
      </div><!-- public-instance-method-details -->
    
      <div id="private-instance-method-details" class="method-section section">
        <h3 class="section-header">Private Instance Methods</h3>

      
        <div id="_getGenericQuery-method" class="method-detail ">
          <a name="method-i-_getGenericQuery"></a>

          
          <div class="method-heading">
            <span class="method-name">_getGenericQuery</span><span
              class="method-args">( type, *args )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns an instance of Basic* child dialect-specific class</p>
            

            
            <div class="method-source-code" id="_getGenericQuery-source">
<pre>
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 180</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">_getGenericQuery</span> ( <span class="ruby-identifier">type</span>, *<span class="ruby-identifier">args</span> )
    <span class="ruby-identifier">class_basic</span> = <span class="ruby-string">'Basic'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">capitalize</span>
    <span class="ruby-identifier">class_child</span> = <span class="ruby-identifier">class_basic</span> <span class="ruby-operator">+</span> <span class="ruby-string">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@dialect</span>
    <span class="ruby-keyword">begin</span>
        <span class="ruby-ivar">@obj</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">class_child</span> ).<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>, *<span class="ruby-identifier">args</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
        <span class="ruby-ivar">@obj</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">class_basic</span> ).<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>, *<span class="ruby-identifier">args</span>
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- _getGenericQuery-source -->
            
          </div>

          

          
        </div><!-- _getGenericQuery-method -->

      
      </div><!-- private-instance-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>

